package top.laoshuzi.common.base;

import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class CommonDataBindFragment<B extends ViewDataBinding> extends CommonFragment {

    B dataBinding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.inflate(inflater, layoutId(), container, false);
        return dataBinding.getRoot();
    }

    public B getBinding() {
        return dataBinding;
    }

    public abstract int layoutId();

}
